All Functions Used So Far, Week 8

summarize

{dplyr}

Collapse the dataset to a summary statistic (American-spelling alias of summarise)

aggregate

{stats}

Compute summary statistics of data subsets / by groups

hist

{graphics}

Plot a simple histogram

desc

{dplyr}

Arrange in descending order

head

{utils}

Show first 5 rows of a data frame

spread

{tidyr}

Spread a key-value pair across multiple columns

separate

{tidyr}

Split columns

ggplot

{GGPLOT2}

Create a ggplot graph

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

geom_histogram

{GGPLOT2}

Generates a histogram

setwd

{base}

Set Working Directory

sd

{stats}

Get standard deviation of a vector

plot

{graphics}

Generic function from base R to produce a plot

is.na

{base}

Check if a value is NA/elements of vector are NA

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

boxplot

{graphics}

Plot a simple box plot

select

{dplyr}

Select columns from a tibble/data frame

print

{base}

Print object to the console

var

{stats}

Calculate variance

recode_factor

{dplyr}

Recode factor values, changing the levels and their order

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

which.max

{base}

return index of the largest value in a vector

as.numeric

{base}

Coerce a vector to numeric

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

mutate

{dplyr}

Create new variables

install_rsthemes

{rsthemes}

Install the rsthemes collection of RStudio themes

str

{utils}

Get the structure of an R object

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

write.csv

{utils}

write a csv file to a data frame

labs

{GGPLOT2}

Customise labels in GGPLOT2

max

{base}

Get maximum of a vector

filter

{dplyr}

Filter out rows of a data frame according to logical vector

write_dta

{haven}

Write Stata files

as.character

{base}

Coerce a vector to character

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

read_excel

{readxl}

Read an Excel file

factor

{base}

Create a factor

View

{base}

View a data frame

slice

{dplyr}

Select rows by position

min

{base}

Get minimum of a vector

median

{stats}

Get median of a vector

arrange

{dplyr}

Sort values of data frame according to a variable/combination of variables

cut

{base}

Convert Numeric to Factor

ordered

{dplyr}

Create an ordered factor

summary

{base}

Obtain summary statistics or detailed regression output

levels

{base}

Get levels of a factor

order

{base}

Get indexes that will sort a vector

ifelse

{base}

Return a or b depending on the value of test

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

recode

{dplyr}

Recode a variable

read_dta

{haven}

Read a .dta file (Stata data)

seq

{base}

Create a sequence

data.frame

{base}

Create a data.frame from vectors

length

{base}

Returns number of elements in an object

rm

{base}

Remove objects

n

{dplyr}

The number of observations in the current group.

sum

{base}

Get sum of numeric values or a vector

save

{base}

Save R objects

quantile

{stats}

Obtain empirical quantiles of a vector

names

{base}

Get or set names of an object

c

{base}

Combine values/vectors into a vector

range

{base}

Return range of values

mean

{base}

Get mean of a vector

factor

{base}

Create factor variables

which.min

{base}

Return the index of the smallest value in a vector

install.packages

{utils}

Install R packages

ungroup

{dplyr}

Resolve grouping created with “group_by”

library

{base}

Load an R package

with

{base}

evaluate expression in the context of a data frame

nrow

{base}

Get number of rows of a data frame

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

The end!